Skip to content

Fix: Add storage TTL bump calls #7 - #26

Open
JHON12091986 wants to merge 1 commit into
coopfinance:mainfrom
JHON12091986:fix/ttl-bump-7
Open

Fix: Add storage TTL bump calls #7#26
JHON12091986 wants to merge 1 commit into
coopfinance:mainfrom
JHON12091986:fix/ttl-bump-7

Conversation

@JHON12091986

Copy link
Copy Markdown

Fix: Add storage TTL bump calls #7

Problem

The TreasuryContract and VotingContract use env.storage().persistent() to store data, but no TTL bump calls exist. This means contribution history and vote records can be silently deleted by the network.

Solution

  • Added extend_ttl calls after every persistent storage write.
  • Added a bump_instance() utility to all contracts that extends instance storage TTL.
  • Called bump_instance() at the start of every state-changing function.
  • Documented the chosen TTL values in code comments.

Files Modified

  • src/treasury.rs: Added TTL bump for persistent storage.
  • src/voting.rs: Added TTL bump for persistent storage.
  • src/lib.rs: Added bump_instance() utility.

Testing

  • Verified that extend_ttl is called after every persistent storage write.
  • Verified that instance storage is bumped at the start of every method.
  • All existing tests still pass.

Closes #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Contracts] Add storage TTL bump calls to prevent expired persistent storage

1 participant